<?php

namespace App\Repositories\Warehouse;

use Illuminate\Container\Container as Application;
use Prettus\Repository\Eloquent\BaseRepository;
use Prettus\Repository\Criteria\RequestCriteria;
use App\Repositories\Warehouse\WarehouseRepository;
use App\Models\Warehouse\Warehouse;
use App\Validators\Warehouse\WarehouseValidator;

/**
 * Class WarehouseRepositoryEloquent.
 *
 * @package namespace App\Repositories\Warehouse;
 */
class WarehouseRepositoryEloquent extends BaseRepository implements WarehouseRepository
{

    /**
     * Specify Model class name
     *
     * @return string
     */
    public function model()
    {
        return Warehouse::class;
    }

    /**
     * 根据仓库ID查询对应仓库的基本信息
    */
    public function GetWarehouseInfo($wid){
        if(empty($wid)){
            return false;
        }
        $info=$this->findWhere([['id','=',$wid]])->first()->toArray();
        if($info){
            return $info;
        }
        return false;
    }

    /**
     * Boot up the repository, pushing criteria
     */
    public function boot()
    {
        $this->pushCriteria(app(RequestCriteria::class));
    }
    
}
